﻿using System;

namespace LA
{
    public class BizAlertException : Exception
    {
        public string ErrorCode { get; set; }
        public object Value { get; set; }

        /// <summary>
        /// 一般错误
        /// </summary>
        /// <param name="message"></param>
        public BizAlertException(string message) : this("ERR_GENERAL_ERROR", message)
        {

        }

        /// <summary>
        /// 带有错误标记的错误信息
        /// </summary>
        /// <param name="errcode"></param>
        /// <param name="message"></param>
        public BizAlertException(string errcode, string message) : base(message)
        {
            this.ErrorCode = errcode;
        }


        public BizAlertException(string message, Exception innerException) : this("ERR_GENERAL_ERROR", message, innerException)
        {
            this.ErrorCode = ErrorCode;
        }

        public BizAlertException(string errcode, string message, Exception innerException) : base(message, innerException)
        {
            this.ErrorCode = errcode;
        }

        public BizAlertException(string errcode, string message, object value) : base(message)
        {
            this.ErrorCode = errcode;
            this.Value = value;
        }

        public BizAlertException(string errcode, string message, object value, Exception innerException) : base(message, innerException)
        {
            this.ErrorCode = errcode;
            this.Value = value;
        }

        public override string ToString()
        {
            return base.Message;
        }
    }
}
